<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />

    <link rel="stylesheet" type="text/css" href="/static/admin/static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="/static/admin/static/h-ui.admin.pro.iframe/css/H-ui.login.min.css" />
    <link rel="stylesheet" type="text/css" href="/static/admin/lib/Hui-iconfont/1.0.9/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="/static/admin/static/business/css/style.css" />

    <title>后台登录</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
</head>
<body>
<div class="loginWraper">

    <div class="loginBox">
        <center>
            <div style="color:orangered;font-size: 16px;" id="msg"></div>
        </center>
        <form id="form-admin-login" class="form form-horizontal" action="index.html" method="post">
            <div class="row clearfix">
                <input type="hidden" value="{{.session_admin_id}}">
                <label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60d;</i></label>
                <div class="form-controls col-xs-7">
                    <input id="account" name="account" type="text" placeholder="账号" class="input-text size-L">
                </div>
            </div>
            <div class="row clearfix">
                <label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60e;</i></label>
                <div class="form-controls col-xs-7">
                    <input id="password" name="password" type="password" placeholder="密码" class="input-text size-L">
                </div>
            </div>
            <div class="row clearfix">
                <div class="form-controls col-xs-7 col-xs-offset-3">
                    <input id="verificationCode" name="captcha" class="input-text size-L" type="text" placeholder="验证码" value="" style="width:170px;">
                    {{create_captcha}}
                </div>
            </div>

            <div class="row clearfix">
                <div class="form-controls col-xs-8 col-xs-offset-3">
                    <input name="" type="submit" class="btn btn-success radius size-L" value="&nbsp;登&nbsp;&nbsp;&nbsp;&nbsp;录&nbsp;">
                    <input name="" type="reset" class="btn btn-default radius size-L" value="&nbsp;取&nbsp;&nbsp;&nbsp;&nbsp;消&nbsp;">
                </div>
            </div>
        </form>
    </div>
</div>
<div class="footer">Copyright 你的公司名称 by h-ui.admin.pro.iframe v1.0</div>

<script type="text/javascript" src="/static/admin/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/static/admin/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="/static/admin/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="/static/admin/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="/static/admin/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
    $(function(){
        /* 表单验证，提交 */
        $("#form-admin-login").validate({
            rules: {
                account: {
                    required:true,
                },
                password: {
                    required:true,
                    rangelength: [6, 16]
                },
                verificationCode: {
                    required:true,
                }
            },
            messages: {
                account: {
                    required: "账户不能为空"
                },
                password: {
                    required: "密码不能为空",
                    rangelength: "密码长度6到16个字符"
                },
                verificationCode: {
                    required: "验证码不能为空"
                },
            },
            onkeyup: false,
            focusCleanup: false,
            submitHandler: function(form) {
                //在这里执行表单提交
                $(form).ajaxSubmit({
                    type: 'post',
                    url: "/{{config "String" "adminPath" ""}}/DoLogin" ,
                    success: function(data){
                       if(data.code !== 200){
                           $("#msg").html(data.msg);
                           setTimeout(function () {
                               $("#msg").html("");
                           },2000);
                           return false;
                       }else{
                           window.location.href="/{{config "String" "adminPath" ""}}/index/index";
                       }
                    }
                })
            }
        });
    });
</script>
</body>
</html>
